import http from "../utils/http"

// 新增评论
export const addComment = (comment) => {
  return http.post("/comment/add", comment)
}

// 查询评论
export const queryComment = ({userid, orderid, storeid}) => {
  let url = "/comment/queryComments"
  let count = 0
  if (userid) {
    url += `?userId=${userid}`
    count ++
  }if (orderid) {
    url  += (count === 0) ? `?orderId=${orderid}` :`&orderId=${orderid}`
    count ++
  }if (storeid) {
    url  += (count === 0) ? `?storeId=${storeid}` :`&storeId=${storeid}`
  }
  return http.get(url)
}